//继承模板
{extend name="public/base"}


//CSS
{block name="style"}
<link rel="stylesheet" href="__ADMIN_STATIC__/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
{/block}


{block name="breadcrumb" title="当前位置"}{/block}

//正文区域
{block name="body"}{//---------------------------------------------------------------------------}
<article class="page-container">
	<form class="form form-horizontal" id="form1">
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>配置ID:</label>
			<div class="formControls col-xs-8 col-sm-5">
				{$info.id | default="ID自增长" }
			</div>
			<div class="formControls col-xs-8 col-sm-5">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>配置标识：</label>
			<div class="formControls col-xs-8 col-sm-5">
				<input type="text" class="input-text" value="{$info.name|default=''}" placeholder="" name="name" data-rule-required="true" />
			</div>
			<div class="formControls col-xs-8 col-sm-5">（用于config函数调用，只能使用英文且不能重复）
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>配置标题：</label>
			<div class="formControls col-xs-8 col-sm-5">
				<input type="text" class="input-text" value="{$info.title|default=''}" placeholder="" name="title" data-rule-required="true" />
			</div>
			<div class="formControls col-xs-8 col-sm-5">（用于后台显示的配置标题）
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>排序：</label>
			<div class="formControls col-xs-8 col-sm-5">
				<input type="text" class="input-text" value="{$info.sort|default=0}" placeholder="" name="sort" />
			</div>
			<div class="formControls col-xs-8 col-sm-5">（用于分组显示的顺序）
			</div>
		</div>

<!-- 		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>状态：</label>
			<div class="formControls col-xs-8 col-sm-5">

			{volist name="['禁用','开启']" id="status"}
				<div class="radio-box">
					<input type="radio"  name="status" value="{$key}" {eq name="key" value="$info['status']"}checked{/eq}>
					<label for="sex-0">{$status}</label>
				</div>		
			{/volist}

			</div>
			<div class="formControls col-xs-8 col-sm-5">
			</div>
		</div>
 -->
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>配置分组：</label>
			<div class="formControls col-xs-8 col-sm-5">
				<span class="select-box">
				<select name="group" class="select" name="group">
					<option value="0"> 不分组 </option>
					{volist name=":config('config_group_list')" id="group"}
						<option value="{$key}" {eq name="key" value="$info['group']"}selected{/eq}>{$group}</option>
					{/volist}
				</select>
				</span>
			</div>
			<div class="formControls col-xs-8 col-sm-5">（配置分组 用于批量设置 不分组则不会显示在系统设置中）
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>配置类型：</label>
			<div class="formControls col-xs-8 col-sm-5">
				<span class="select-box" name="type">
				<select name="type" class="select" data-rule-required="true" >
				{volist name=":config('config_type_list')" id="type"}
					<option value="{$key}" {eq name="key" value="$info['type']"}selected{/eq}>{$type}</option>
				{/volist}
				</select>
				</span>
			</div>
			<div class="formControls col-xs-8 col-sm-5">（系统会根据不同类型解析配置值）
			</div>
		</div>

		<div class="row cl">
				</span>
			<label class="form-label col-xs-4 col-sm-2">配置项：</label>
			<div class="formControls col-xs-8 col-sm-5">
				<textarea class="textarea" placeholder="0:AAA
1:BBB
2:CCC" rows="" cols="" name="extra">{$info.extra|default=''}</textarea>
			</div>
			<div class="formControls col-xs-8 col-sm-5"> （如果是枚举型 需要配置该项）
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>配置值：</label>
			<div class="formControls col-xs-8 col-sm-5">
				<textarea name="value" class="textarea">{$info.value|default=''}</textarea>
			</div>
			<div class="formControls col-xs-8 col-sm-5">（配置值）
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">配置说明：</label>
			<div class="formControls col-xs-8 col-sm-5">
				<textarea class="textarea" placeholder="说点什么..." rows="" cols="" name="remark">{$info.remark|default=''}</textarea>
			</div>
			<div class="formControls col-xs-8 col-sm-5">
			</div>
		</div>
<?php
/*
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>小图标：</label>
			<div class="formControls col-xs-8 col-sm-5">
				<input type="text" class="input-text" value="{$info.icon|default=''}" placeholder="" name="icon" data-rule-required="true" />
			</div>
			<div class="formControls col-xs-8 col-sm-5">
			</div>
		</div>
		

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>配置值：</label>
			<div class="formControls col-xs-8 col-sm-5">
				<input type="text" class="input-text" value="{$info.value|default=''}" placeholder="" name="value" />
			</div>
			<div class="formControls col-xs-8 col-sm-5">
			</div>
		</div>
*/?>



		<div class="row cl">
			<div class="col-xs-8 col-sm-5 col-xs-offset-4 col-sm-offset-2">
				<input type="hidden" name="id"  value="{$info.id|default=0}"/>
				<button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存并提交 </button>

				<button onClick="m.colseIframeSelf(1);" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
			</div>
		</div>
	</form>
</article>



{/block}
//-----------------------------------------------------------------------------------------------


<!--请在下方写此页面业务相关的脚本-->
//-----------------------------------------------------------------------------------------------
{block name="script"}

<script type="text/javascript">




$(function(){
	//
	// $("#tab-category").Huitab({
	// 	index:0
	// });

	//返回顶部
	$.Huitotop();

	//表单验证 提交
	$('#form1').validate({
		onkeyup:false, //在 keyup 时验证。
        onclick:false, // 在点击复选框和单选按钮时验证。
        onfocusout:false, //失去焦点时验证（不包括复选框/单选按钮）。
        onsubmit:true ,   // 提交时验证。设置为 false 就用其他方法去验证。
		focusCleanup:true,focusInvalid:false,
		success:"valid", //验证成功 添加样式
		rules: {

      	},
		submitHandler:function(form){
            jBox.tip('loading...' , 'loading') ; 

            var $form  = $("form");
            var url = $form.attr('action');
            var type = $form.attr('method') || 'post';
            var data = $form.serialize();
            $.ajax({
            	url: url ,
            	type:type , // get post
            	data: data , 
            	dataType : 'html' ,
            	success:function(d){
            		try{d = JSON.parse(d);}catch(err){jBox.alert( d , '查看ajax返回值');return false;}
				    if( 1 == d.code){
				    	jBox.tip( d.msg , 'success');
				    	setTimeout(function(){layer_close(1);},1000);
				    }else{
				    	jBox.tip( d.msg , 'error');
				    }
            	},
            	error:function(XMLHttpRequest, textStatus, errorThrown){
            		console.log( 'ajaxError : ' + textStatus );
            	},
            	complete:function(){
            		setTimeout(function(){jBox.closeTip();},3000);
            	}
            });

		},
		showErrors:function(errorMap,errorList) {
			this.defaultShowErrors(); //默认验证 
			if( this.numberOfInvalids() ){
				jBox.tip( '有' + this.numberOfInvalids() + '个错误，请检查！' ,'error');
			}
    	}
	});
});

//--------------------------------------------




</script>

<style>
	

	
</style>



{/block}{//---------------------------------------------------------------------------}